<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改【请填写功能名称】')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-city-edit" th:object="${sysCity}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">国家id：</label>
                <div class="col-sm-8">
                    <!--<input name="countryId" th:field="*{countryId}" class="form-control" type="text">-->
                    <select id="country" class="form-control m-b" name="countryId">
                        <option value="">--请选择国家--</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">省份名称：</label>
                <div class="col-sm-8">
                    <input name="city" th:field="*{city}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">排序：</label>
                <div class="col-sm-8">
                    <input name="initial" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">

        //页面一加载调取后台查询全部省份的方法
        $.ajax({
            url:ctx + "app/country/appList",
            type:"post",
            dataType:"json",
            success:function(data){
                console.log(data)
                $(data.data).each(function(a,b){
                    var countryId = b.id;
                    $("#country").append("<option value='"+countryId+"'>"+b.country+"</option>");
                });
            },
            error:function(){

            }
        });

        var prefix = ctx + "app/city";
        $("#form-city-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-city-edit').serialize());
            }
        }
    </script>
</body>
</html>